import request from '@/utils/request'

/**
 * 实列编辑
 * @param data 
 * @returns 
 */
export const ExampleSave= (data:ExampleEdit): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'example', data ,method:'POST'}) : request({ url: `example/${data.id}`, data ,method:'PUT'})
/**
 * 实列删除
 * @param id 
 * @returns 
 */
export const ExampleDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `example/${id}`,method:'DELETE'})
/**
 * 实列详情
 * @param id 
 * @returns 
 */
export const GetExampleDetails =(id:number):Promise<ServiceResponse<ExampleEdit>>=>request({url:`example/${id}`})

/**
 * 实列排序修改
 * @param id 
 * @param sequence 
 * @returns 
 */
export const ExampleUpdateSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'example/sequence', data:{id , sequence} ,method:'GET'})

/**
 * 
 * @param data 实列分类编辑
 * @returns 
 */
export const ExampleCategorySave= (data:CategoryInfo): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'example/category', data ,method:'POST'}) : request({ url: `example/category/${data.id}`, data ,method:'PUT'})

/**
 * 实列分类删除
 * @param id 
 * @returns 
 */
export const ExampleCategoryDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `example/category/${id}`,method:'DELETE'})

/**
 * 实列分类排序修改
 * @param id 
 * @param sequence 
 * @returns 
 */
export const ExampleCategoryUpdateSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'example/category/sequence', data:{id , sequence} ,method:'GET'})

/**
 * 分类列表
 * @param name 
 * @returns 
 */
export const GetExampleCategorys = (name: string): Promise<ServiceResponse<CategoryInfo[]>> => request({url: 'example/category/list',data: { name },method:'GET'})

/**
 *  顾问编辑
 * @param data
 * @returns 
 */
export const ExampleAdviserSave= (data:AdviserEdit): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'example/adviser', data ,method:'POST'}) : request({ url: `example/adviser/${data.id}`, data ,method:'PUT'})

/**
 * 顾问删除
 * @param id 
 * @returns 
 */
export const ExampleAdviserDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `example/adviser/${id}`,method:'DELETE'})

/**
 *  顾问列表
 * @param data 
 * @returns 
 */
export const Examples = (data: PageModel<AdviserQuery>): Promise<ServiceResponse<AdviserView[]>> => request({ url: `example/adviser/list`,data,method:'POST'})

/**
 * 行业
 * @param data 
 * @returns 
 */
export const ExampleIndustrySave= (data:IndustryInfo): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'example/industry', data ,method:'POST'}) : request({ url: `example/industry/${data.id}`, data ,method:'PUT'})
/**
 * 行业删除
 * @param id 
 * @returns 
 */
export const ExampleIndustryDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `example/industry/${id}`,method:'DELETE'})

/**
 * 行业排序修改
 * @param id 
 * @param sequence 
 * @returns 
 */
export const ExampleIndustryUpdateSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'example/industry/sequence', data:{id , sequence} ,method:'GET'})

/**
 * 行业列表
 * @param name 
 * @returns 
 */ 
export const GetExampleIndustrys = (name: string): Promise<ServiceResponse<IndustryInfo[]>> => request({url: 'example/industry/list',data: { name },method:'GET'})


/**
 * 客户需求
 * @param data 
 * @returns 
 */
export const ExampleActivitySave= (data:ActivityInfo): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'example/activity', data ,method:'POST'}) : request({ url: `example/activity/${data.id}`, data ,method:'PUT'})
/**
 * 客户需求删除
 * @param id 
 * @returns 
 */
export const ExampleActivityDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `example/activity/${id}`,method:'DELETE'})

/**
 * 客户需求排序修改
 * @param id 
 * @param sequence 
 * @returns 
 */
export const ExampleActivityUpdateSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'example/activity/sequence', data:{id , sequence} ,method:'GET'})

/**
 * 客户需求列表
 * @param name 
 * @returns 
 */ 
export const GetExampleActivitys = (name: string): Promise<ServiceResponse<ActivityInfo[]>> => request({url: 'example/activity/list',data: { name },method:'GET'})
